@@ -93,8 +93,9 @@ group :development, :test do |
||
93 | 93 |
gem 'vcr' |
94 | 94 |
gem 'dotenv-rails' |
95 | 95 |
gem 'pry' |
96 |
- gem 'rspec-rails', '~> 2.14' |
|
97 |
- gem 'rspec', '~> 2.14' |
|
96 |
+ gem 'rspec-rails', '~> 2.99' |
|
97 |
+ gem 'rspec', '~> 2.99' |
|
98 |
+ gem 'rspec-collection_matchers' |
|
98 | 99 |
gem 'shoulda-matchers' |
99 | 100 |
gem 'rr' |
100 | 101 |
gem 'delorean' |
@@ -433,8 +433,9 @@ DEPENDENCIES |
||
433 | 433 |
rails (= 4.1.4) |
434 | 434 |
rails_12factor |
435 | 435 |
rr |
436 |
- rspec (~> 2.14) |
|
437 |
- rspec-rails (~> 2.14) |
|
436 |
+ rspec (~> 2.99) |
|
437 |
+ rspec-collection_matchers |
|
438 |
+ rspec-rails (~> 2.99) |
|
438 | 439 |
rturk (~> 2.12.1) |
439 | 440 |
ruby-growl (~> 4.1.0) |
440 | 441 |
rufus-scheduler (~> 3.0.8) |
@@ -14,7 +14,7 @@ describe AgentsController do |
||
14 | 14 |
it "only returns Agents for the current user" do |
15 | 15 |
sign_in users(:bob) |
16 | 16 |
get :index |
17 |
- assigns(:agents).all? {|i| i.user.should == users(:bob) }.should be_true |
|
17 |
+ assigns(:agents).all? {|i| i.user.should == users(:bob) }.should be_truthy |
|
18 | 18 |
end |
19 | 19 |
end |
20 | 20 |
|
@@ -10,14 +10,14 @@ describe EventsController do |
||
10 | 10 |
it "only returns Events created by Agents of the current user" do |
11 | 11 |
sign_in users(:bob) |
12 | 12 |
get :index |
13 |
- assigns(:events).all? {|i| i.user.should == users(:bob) }.should be_true |
|
13 |
+ assigns(:events).all? {|i| i.user.should == users(:bob) }.should be_truthy |
|
14 | 14 |
end |
15 | 15 |
|
16 | 16 |
it "can filter by Agent" do |
17 | 17 |
sign_in users(:bob) |
18 | 18 |
get :index, :agent_id => agents(:bob_website_agent) |
19 | 19 |
assigns(:events).length.should == agents(:bob_website_agent).events.length |
20 |
- assigns(:events).all? {|i| i.agent.should == agents(:bob_website_agent) }.should be_true |
|
20 |
+ assigns(:events).all? {|i| i.agent.should == agents(:bob_website_agent) }.should be_truthy |
|
21 | 21 |
|
22 | 22 |
lambda { |
23 | 23 |
get :index, :agent_id => agents(:jane_website_agent) |
@@ -6,7 +6,7 @@ describe LogsController do |
||
6 | 6 |
sign_in users(:bob) |
7 | 7 |
get :index, :agent_id => agents(:bob_weather_agent).id |
8 | 8 |
assigns(:logs).length.should == agents(:bob_weather_agent).logs.length |
9 |
- assigns(:logs).all? {|i| i.agent.should == agents(:bob_weather_agent) }.should be_true |
|
9 |
+ assigns(:logs).all? {|i| i.agent.should == agents(:bob_weather_agent) }.should be_truthy |
|
10 | 10 |
end |
11 | 11 |
|
12 | 12 |
it "only loads Agents owned by the current user" do |
@@ -12,7 +12,7 @@ describe ScenariosController do |
||
12 | 12 |
describe "GET index" do |
13 | 13 |
it "only returns Scenarios for the current user" do |
14 | 14 |
get :index |
15 |
- assigns(:scenarios).all? {|i| i.user.should == users(:bob) }.should be_true |
|
15 |
+ assigns(:scenarios).all? {|i| i.user.should == users(:bob) }.should be_truthy |
|
16 | 16 |
end |
17 | 17 |
end |
18 | 18 |
|
@@ -50,7 +50,7 @@ describe ScenariosController do |
||
50 | 50 |
assigns(:exporter).options[:description].should == scenarios(:bob_weather).description |
51 | 51 |
assigns(:exporter).options[:agents].should == scenarios(:bob_weather).agents |
52 | 52 |
assigns(:exporter).options[:guid].should == scenarios(:bob_weather).guid |
53 |
- assigns(:exporter).options[:source_url].should be_false |
|
53 |
+ assigns(:exporter).options[:source_url].should be_falsey |
|
54 | 54 |
response.headers['Content-Disposition'].should == 'attachment; filename="bob-s-weather-alert-scenario.json"' |
55 | 55 |
response.headers['Content-Type'].should == 'application/json; charset=utf-8' |
56 | 56 |
JSON.parse(response.body)["name"].should == scenarios(:bob_weather).name |
@@ -15,7 +15,7 @@ describe UserCredentialsController do |
||
15 | 15 |
describe "GET index" do |
16 | 16 |
it "only returns UserCredentials for the current user" do |
17 | 17 |
get :index |
18 |
- assigns(:user_credentials).all? {|i| i.user.should == users(:bob) }.should be_true |
|
18 |
+ assigns(:user_credentials).all? {|i| i.user.should == users(:bob) }.should be_truthy |
|
19 | 19 |
end |
20 | 20 |
end |
21 | 21 |
|
@@ -89,7 +89,7 @@ describe DotHelper do |
||
89 | 89 |
end |
90 | 90 |
end |
91 | 91 |
|
92 |
- describe DotHelper::DotDrawer do |
|
92 |
+ describe "DotHelper::DotDrawer" do |
|
93 | 93 |
describe "#id" do |
94 | 94 |
it "properly escapes double quotaion and backslash" do |
95 | 95 |
DotHelper::DotDrawer.draw(foo: "") { |
@@ -20,7 +20,7 @@ describe AgentsExporter do |
||
20 | 20 |
Time.parse(data[:exported_at]).should be_within(2).of(Time.now.utc) |
21 | 21 |
data[:links].should == [{ :source => 0, :receiver => 1 }] |
22 | 22 |
data[:agents].should == agent_list.map { |agent| exporter.agent_as_json(agent) } |
23 |
- data[:agents].all? { |agent_json| agent_json[:guid].present? && agent_json[:type].present? && agent_json[:name].present? }.should be_true |
|
23 |
+ data[:agents].all? { |agent_json| agent_json[:guid].present? && agent_json[:type].present? && agent_json[:name].present? }.should be_truthy |
|
24 | 24 |
|
25 | 25 |
data[:agents][0].should_not have_key(:propagate_immediately) # can't receive events |
26 | 26 |
data[:agents][1].should_not have_key(:schedule) # can't be scheduled |
@@ -213,7 +213,7 @@ describe Agent do |
||
213 | 213 |
@checker.last_check_at.should be_nil |
214 | 214 |
Agents::SomethingSource.async_check(@checker.id) |
215 | 215 |
@checker.reload.last_check_at.should be_within(2).of(Time.now) |
216 |
- @checker.reload.options[:new].should be_true # Show that we save options |
|
216 |
+ @checker.reload.options[:new].should be_truthy # Show that we save options |
|
217 | 217 |
end |
218 | 218 |
|
219 | 219 |
it "should log exceptions" do |
@@ -60,7 +60,7 @@ describe Agents::GrowlAgent do |
||
60 | 60 |
end |
61 | 61 |
|
62 | 62 |
@checker.register_growl |
63 |
- called.should be_true |
|
63 |
+ called.should be_truthy |
|
64 | 64 |
end |
65 | 65 |
end |
66 | 66 |
|
@@ -78,7 +78,7 @@ describe Agents::GrowlAgent do |
||
78 | 78 |
mock(obj).notify(@checker.options[:growl_notification_name],subject,message) |
79 | 79 |
end |
80 | 80 |
@checker.notify_growl(subject,message) |
81 |
- called.should be_true |
|
81 |
+ called.should be_truthy |
|
82 | 82 |
end |
83 | 83 |
end |
84 | 84 |
|
@@ -323,7 +323,7 @@ describe Agents::HumanTaskAgent do |
||
323 | 323 |
|
324 | 324 |
@checker.send :review_hits |
325 | 325 |
|
326 |
- assignments.all? {|a| a.approved == true }.should be_false |
|
326 |
+ assignments.all? {|a| a.approved == true }.should be_falsey |
|
327 | 327 |
@checker.memory['hits'].should == { "JH3132836336DHG" => { 'event_id' => @event.id } } |
328 | 328 |
end |
329 | 329 |
|
@@ -341,7 +341,7 @@ describe Agents::HumanTaskAgent do |
||
341 | 341 |
|
342 | 342 |
@checker.send :review_hits |
343 | 343 |
|
344 |
- assignments.all? {|a| a.approved == true }.should be_false |
|
344 |
+ assignments.all? {|a| a.approved == true }.should be_falsey |
|
345 | 345 |
@checker.memory['hits'].should == { "JH3132836336DHG" => { 'event_id' => @event.id } } |
346 | 346 |
end |
347 | 347 |
|
@@ -360,7 +360,7 @@ describe Agents::HumanTaskAgent do |
||
360 | 360 |
@checker.send :review_hits |
361 | 361 |
}.should change { Event.count }.by(1) |
362 | 362 |
|
363 |
- assignments.all? {|a| a.approved == true }.should be_true |
|
363 |
+ assignments.all? {|a| a.approved == true }.should be_truthy |
|
364 | 364 |
hit.should be_disposed |
365 | 365 |
|
366 | 366 |
@checker.events.last.payload['answers'].should == [ |
@@ -405,7 +405,7 @@ describe Agents::HumanTaskAgent do |
||
405 | 405 |
@checker.send :review_hits |
406 | 406 |
}.should change { Event.count }.by(1) |
407 | 407 |
|
408 |
- assignments.all? {|a| a.approved == true }.should be_true |
|
408 |
+ assignments.all? {|a| a.approved == true }.should be_truthy |
|
409 | 409 |
|
410 | 410 |
@checker.events.last.payload['answers'].should == [ |
411 | 411 |
{ 'sentiment' => "sad", 'age_range' => "<50" }, |
@@ -458,7 +458,7 @@ describe Agents::HumanTaskAgent do |
||
458 | 458 |
@checker.send :review_hits |
459 | 459 |
}.should change { Event.count }.by(1) |
460 | 460 |
|
461 |
- assignments.all? {|a| a.approved == true }.should be_true |
|
461 |
+ assignments.all? {|a| a.approved == true }.should be_truthy |
|
462 | 462 |
|
463 | 463 |
@checker.events.last.payload['answers'].should == [ |
464 | 464 |
{ 'rating' => "1" }, |
@@ -520,7 +520,7 @@ describe Agents::HumanTaskAgent do |
||
520 | 520 |
|
521 | 521 |
# it approves the existing assignments |
522 | 522 |
|
523 |
- assignments.all? {|a| a.approved == true }.should be_true |
|
523 |
+ assignments.all? {|a| a.approved == true }.should be_truthy |
|
524 | 524 |
hit.should be_disposed |
525 | 525 |
|
526 | 526 |
# it creates a new HIT for the poll |
@@ -582,7 +582,7 @@ describe Agents::HumanTaskAgent do |
||
582 | 582 |
|
583 | 583 |
# it approves the existing assignments |
584 | 584 |
|
585 |
- assignments.all? {|a| a.approved == true }.should be_true |
|
585 |
+ assignments.all? {|a| a.approved == true }.should be_truthy |
|
586 | 586 |
hit.should be_disposed |
587 | 587 |
|
588 | 588 |
@checker.memory['hits'].should be_empty |
@@ -53,7 +53,7 @@ describe Agents::WeiboPublishAgent do |
||
53 | 53 |
Agents::WeiboPublishAgent.async_receive(@checker.id, [event.id]) |
54 | 54 |
@sent_messages.count.should eq(1) |
55 | 55 |
@checker.events.count.should eq(1) |
56 |
- @sent_messages.first.include?("t.co").should_not be_true |
|
56 |
+ @sent_messages.first.include?("t.co").should_not be_truthy |
|
57 | 57 |
end |
58 | 58 |
end |
59 | 59 |
|
@@ -184,7 +184,7 @@ describe ScenarioImport do |
||
184 | 184 |
scenario_import.scenario.description.should == description |
185 | 185 |
scenario_import.scenario.guid.should == guid |
186 | 186 |
scenario_import.scenario.source_url.should == source_url |
187 |
- scenario_import.scenario.public.should be_false |
|
187 |
+ scenario_import.scenario.public.should be_falsey |
|
188 | 188 |
end |
189 | 189 |
|
190 | 190 |
it "creates the Agents" do |
@@ -198,7 +198,7 @@ describe ScenarioImport do |
||
198 | 198 |
weather_agent.name.should == "a weather agent" |
199 | 199 |
weather_agent.schedule.should == "5pm" |
200 | 200 |
weather_agent.keep_events_for.should == 14 |
201 |
- weather_agent.propagate_immediately.should be_false |
|
201 |
+ weather_agent.propagate_immediately.should be_falsey |
|
202 | 202 |
weather_agent.should be_disabled |
203 | 203 |
weather_agent.memory.should be_empty |
204 | 204 |
weather_agent.options.should == weather_agent_options |
@@ -207,7 +207,7 @@ describe ScenarioImport do |
||
207 | 207 |
trigger_agent.sources.should == [weather_agent] |
208 | 208 |
trigger_agent.schedule.should be_nil |
209 | 209 |
trigger_agent.keep_events_for.should == 0 |
210 |
- trigger_agent.propagate_immediately.should be_true |
|
210 |
+ trigger_agent.propagate_immediately.should be_truthy |
|
211 | 211 |
trigger_agent.should_not be_disabled |
212 | 212 |
trigger_agent.memory.should be_empty |
213 | 213 |
trigger_agent.options.should == trigger_agent_options |
@@ -284,7 +284,7 @@ describe ScenarioImport do |
||
284 | 284 |
existing_scenario.description.should == description |
285 | 285 |
existing_scenario.name.should == name |
286 | 286 |
existing_scenario.source_url.should == source_url |
287 |
- existing_scenario.public.should be_false |
|
287 |
+ existing_scenario.public.should be_falsey |
|
288 | 288 |
end |
289 | 289 |
|
290 | 290 |
it "updates any existing agents in the scenario, and makes new ones as needed" do |
@@ -302,7 +302,7 @@ describe ScenarioImport do |
||
302 | 302 |
weather_agent.name.should == "a weather agent" |
303 | 303 |
weather_agent.schedule.should == "5pm" |
304 | 304 |
weather_agent.keep_events_for.should == 14 |
305 |
- weather_agent.propagate_immediately.should be_false |
|
305 |
+ weather_agent.propagate_immediately.should be_falsey |
|
306 | 306 |
weather_agent.should be_disabled |
307 | 307 |
weather_agent.memory.should be_empty |
308 | 308 |
weather_agent.options.should == weather_agent_options |
@@ -311,7 +311,7 @@ describe ScenarioImport do |
||
311 | 311 |
trigger_agent.sources.should == [weather_agent] |
312 | 312 |
trigger_agent.schedule.should be_nil |
313 | 313 |
trigger_agent.keep_events_for.should == 0 |
314 |
- trigger_agent.propagate_immediately.should be_true |
|
314 |
+ trigger_agent.propagate_immediately.should be_truthy |
|
315 | 315 |
trigger_agent.should_not be_disabled |
316 | 316 |
trigger_agent.memory.should be_empty |
317 | 317 |
trigger_agent.options.should == trigger_agent_options |
@@ -330,7 +330,7 @@ describe ScenarioImport do |
||
330 | 330 |
|
331 | 331 |
scenario_import.should be_valid |
332 | 332 |
|
333 |
- scenario_import.import.should be_true |
|
333 |
+ scenario_import.import.should be_truthy |
|
334 | 334 |
|
335 | 335 |
weather_agent = existing_scenario.agents.find_by(:guid => "a-weather-agent") |
336 | 336 |
weather_agent.name.should == "updated name" |
@@ -350,7 +350,7 @@ describe ScenarioImport do |
||
350 | 350 |
} |
351 | 351 |
} |
352 | 352 |
|
353 |
- scenario_import.import.should be_false |
|
353 |
+ scenario_import.import.should be_falsey |
|
354 | 354 |
|
355 | 355 |
errors = scenario_import.errors.full_messages.to_sentence |
356 | 356 |
errors.should =~ /Name can't be blank/ |
@@ -37,6 +37,11 @@ RSpec.configure do |config| |
||
37 | 37 |
# instead of true. |
38 | 38 |
config.use_transactional_fixtures = true |
39 | 39 |
|
40 |
+ # rspec-rails 3 will no longer automatically infer an example group's spec type |
|
41 |
+ # from the file location. You can explicitly opt-in to this feature using this |
|
42 |
+ # snippet: |
|
43 |
+ config.infer_spec_type_from_file_location! |
|
44 |
+ |
|
40 | 45 |
# If true, the base class of anonymous controllers will be inferred |
41 | 46 |
# automatically. This will be the default behavior in future versions of |
42 | 47 |
# rspec-rails. |
@@ -7,23 +7,23 @@ shared_examples_for WorkingHelpers do |
||
7 | 7 |
|
8 | 8 |
agent.last_error_log_at = 10.minutes.ago |
9 | 9 |
agent.last_event_at = 10.minutes.ago |
10 |
- agent.recent_error_logs?.should be_true |
|
10 |
+ agent.recent_error_logs?.should be_truthy |
|
11 | 11 |
|
12 | 12 |
agent.last_error_log_at = 11.minutes.ago |
13 | 13 |
agent.last_event_at = 10.minutes.ago |
14 |
- agent.recent_error_logs?.should be_true |
|
14 |
+ agent.recent_error_logs?.should be_truthy |
|
15 | 15 |
|
16 | 16 |
agent.last_error_log_at = 5.minutes.ago |
17 | 17 |
agent.last_event_at = 10.minutes.ago |
18 |
- agent.recent_error_logs?.should be_true |
|
18 |
+ agent.recent_error_logs?.should be_truthy |
|
19 | 19 |
|
20 | 20 |
agent.last_error_log_at = 15.minutes.ago |
21 | 21 |
agent.last_event_at = 10.minutes.ago |
22 |
- agent.recent_error_logs?.should be_false |
|
22 |
+ agent.recent_error_logs?.should be_falsey |
|
23 | 23 |
|
24 | 24 |
agent.last_error_log_at = 2.days.ago |
25 | 25 |
agent.last_event_at = 10.minutes.ago |
26 |
- agent.recent_error_logs?.should be_false |
|
26 |
+ agent.recent_error_logs?.should be_falsey |
|
27 | 27 |
end |
28 | 28 |
end |
29 | 29 |
|